package com.tanhua.dubbo.server.service;

import com.tanhua.common.pojo.User;
import com.tanhua.common.utils.UserThreadLocal;
import com.tanhua.dubbo.server.vo.PageResult;
import com.tanhua.dubbo.server.vo.RecommendUserQueryParam;
import com.tanhua.dubbo.server.vo.TodayBest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Created with IntelliJ IDEA.
 *
 * @ClassName: TodayBestService
 * @Author:王晨晗
 * @Description: 负责佳人推荐功能
 * @Date: 2021/12/28/17:18
 */
@Service
public class TodayBestService {
    @Autowired
    private RecommendUserService recommendUserService;

    /**
     * @description 获取今日佳人信息
     * @updateTime 2021/12/28 20:18
     * @return: com.tanhua.common.vo.TodayBest
     */
    public TodayBest queryTodayBest() {
        //解析token
        User user = UserThreadLocal.get();
        //通过用户id,推荐今日佳人
        TodayBest todayBest = recommendUserService.findTodayBest(user.getId());
        //返回结果数据
        return todayBest;
    }

    /**
     * @description 获取推荐列表信息
     * @param params 查询条件
     * @updateTime 2021/12/28 20:19
     * @return: com.tanhua.common.vo.PageResult
     */
    public PageResult queryRecommendation(RecommendUserQueryParam params) {
        //校验令牌
        User user = UserThreadLocal.get();
        //通过用户id,以及筛选条件 获取推荐列表
        PageResult result = recommendUserService.queryRecommendation1(user.getId(),params);
        //返回结果
        return result;
    }
}
